package com.jcl.recruit.elasticsearch.resume.dao;

import com.jcl.core.db.DatabaseContext;
import com.jcl.core.utils.StringUtils;
import com.jcl.recruit.elasticsearch.mapper.SearchResumeBasicInfoMapper;
import com.jcl.recruit.elasticsearch.resume.model.SearchResumeBasicInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @ClassName SearchResumeBasicInfoDao
 * @Author yyliu
 * @Date 2018/11/13 10:32
 * @Version 1.0
 **/
@Component
public class SearchResumeBasicInfoDao implements SearchResumeBasicInfoMapper {

    @Autowired
    SearchResumeBasicInfoMapper searchResumeBasicInfoMapper;

    @Override
    public List<Map<String, Object>> findAllMap(String corpCode, String channelAccount) {

        return searchResumeBasicInfoMapper.findAllMap(corpCode, channelAccount);
    }

    @Override
    public List<SearchResumeBasicInfo> findAll(String corpCode, String channelAccount) {
        return searchResumeBasicInfoMapper.findAll(corpCode, channelAccount);
    }

    @Override
    public List<Map<String, String>> selectCountBySources(Boolean today) {
        return searchResumeBasicInfoMapper.selectCountBySources(today);
    }

    @Override
    public List<SearchResumeBasicInfo> findList(List<Integer> ids) {
        return searchResumeBasicInfoMapper.findList(ids);
    }

    @Override
    public Map<String, Object> findOneMap(Integer id) {
        return searchResumeBasicInfoMapper.findOneMap(id);
    }

    @Override
    public SearchResumeBasicInfo findOne(Integer id) {
        return searchResumeBasicInfoMapper.findOne(id);
    }

    @Override
    public int add(SearchResumeBasicInfo entity) {
        return searchResumeBasicInfoMapper.add(entity);
    }

    @Override
    public int update(SearchResumeBasicInfo entity) {
        return searchResumeBasicInfoMapper.update(entity);
    }

    @Override
    public int delete(Integer id) {
        return searchResumeBasicInfoMapper.delete(id);
    }


    // ****************************************************************
    // *********          console  部分处理                *************
    // ****************************************************************

    @Override
    public List<SearchResumeBasicInfo> consoleFindList(String dbServerName, Integer limitStart, Integer limitEnd) {
        if (StringUtils.hasLength(dbServerName)) {
            DatabaseContext.setServerName(dbServerName);
        }
        return searchResumeBasicInfoMapper.consoleFindList(dbServerName, limitStart, limitEnd);
    }

    @Override
    public List<Map<String, Object>> consoleFindCount(String dbServerName) {
        if (StringUtils.hasLength(dbServerName)) {
            DatabaseContext.setServerName(dbServerName);
        }
        return searchResumeBasicInfoMapper.consoleFindCount(dbServerName);
    }
}
